<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width,initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no"/>
    <script src="js/jquery-2.1.1.min.js"></script>
    <script src="js/loading.js"></script>
    <script src="js/laydate.js"></script>
    <script src="js/jquery.cookie.js"></script>
    <script src="js/commonTool.js"></script>
     <script>
    $(function(){
      $("#header").load("header.html");
      var addToken=Tool.addTokenToParams;
      laydate.render({
         elem:'#tar_begin',
         min:0,
         done:function(value,date){
             console.log(value);
         }
      });
      laydate.render({
         elem:'#tar_end',
         min:1,
         done:function(value,date){
             console.log(value);
         }
      }); 
      $("#sendfield").click(function(){
         var beginDate=$("#tar_begin").val();
         var endDate=$("#tar_end").val();
         var title=$("#tar_title").val();
         var zn=$("#tar_zn").val();
         var cost=$("#tar_cost").val();
         var content=$("#tar_cont").val();
         var other=$("#tar_qt").val();
         if(beginDate==null||beginDate.trim().length==0){
             alert("任务开始时间不能为空");
             return;
         }
         if(endDate==null||endDate.trim().length==0){
             alert("任务结束时间不能为空");
             return;
         } 
         if(title==null||title.trim().length==0){
             alert("标题内容不能为空");
             return;
         }
         if(content==null||content.trim().length==0){
             alert("内容不能为空");
             return;
         }
         var jdata={'beginDate':beginDate,'endDate':endDate,'tarTitle':title,'tarContent':content,'tarCost':cost,'userZn':zn,'otherExp':other};
         showLoading();
         $.ajax({
    		  type: 'POST',
    		  url: doTask_submit,
    		  contentType:"application/json;charset=UTF-8",
    		  data:JSON.stringify(addToken(jdata)),
    		  xhrFields: {
    		  withCredentials: true
    		           },
    		  crossDomain: true,
    		  success: function(result){
                  hideLoading();
                  var msg=result.result_msg;
                  if(msg=='success')
                    alert("提交成功!");
                  else
                      alert(msg);
    		  },error : function(xhr, errorType, error) {
                    hideLoading();
    				alert(errorType + ', ' + error);   
              }});
      
      
        });
      });
    </script>
    <link rel="stylesheet" href="css/style.css">
    <link rel="stylesheet" href="css/mainstyle.css">
    <style>
        .con_title{
            width: 100%;
            height: 5%;
            min-height: 25px;
            background-color: dodgerblue;
            color: white;
            text-align: left;
            display: table;
        }
        .con_title span{
            padding-left: 10px;
            display: table-cell;
            vertical-align: middle;
        }
        .con_cont{
            position: relative;
            width: 100%;
            height: 100%;
            min-height:500px;
        }
        
        .inner_tit{
            position: relative;
            margin-top: 10px;
            width: 100%;
        }
        .inner_tit span,input{
            float: left;
            margin-left: 5px;
        }
        .inner_cont{
            position: relative;
            width: 100%;
            height: 120px;
            margin-top: 10px;
            
        }
        .inner_cont span,textarea{
            float: left;
            margin-left: 5px;
       }
        textarea{
            width: 80%;
            height: 80%;
            min-height:110px;
        }
        #tar_begin,#tar_end{
            text-align: center;
            width: 100px;
        }
        
        #sendfield{
            text-align: center;
        }
    </style>
    <title>任务创建</title>
</head>
<body>
    <div id="header"></div>
    <div id="content">
    
        <div class="con_title"><span>计划创建</span></div>
        <div id="weekfield" class="con_cont">
            <div class="inner_tit">
            <input id="tar_begin" class="titlecls" type="text" placeholder="请选择开始时间">
            <input id="tar_end" class="titlecls" type="text" placeholder="请选择结束时间">
            </div>
            <br>
            <div class="inner_tit">
            <span>标题:</span>
            <input id="tar_title" class="titlecls" type="text">
            </div>
            <br>
            <div class="inner_tit">
            <span>职能:</span>
            <input id="tar_zn" class="titlecls" type="text">
            </div>
            <br>
            <div class="inner_tit">
            <span>费用:</span>
            <input id="tar_cost" class="titlecls" type="text">
            </div>
            <br>
             <div class="inner_cont"> 
            <span>内容:</span>
            <textarea id="tar_cont" class="contentcls"></textarea>
            </div>
            <div class="inner_cont"> 
            <span>其他:</span>
            <textarea id="tar_qt" class="contentcls"></textarea>
            </div>
            <br>
            <br>
            <div id="sendfield"><button>提交</button></div>
        </div>

        
        <br>
    </div>
</body>
</html>